﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Infrastructure
{
    [AttributeUsage(AttributeTargets.Class, Inherited = true)]
    public class EntityContextTypeAttribute : Attribute
    {
        private string[] fields = null;
        private int accessType = 0;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="accessType">实体数据库类型</param>
        /// <param name="specialAccessCodes">特定编号</param>
        public EntityContextTypeAttribute(int accessType, string[] specialAccessCodes)
            : base()
        {
            this.accessType = accessType;
            fields = specialAccessCodes;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="accessType">实体数据库类型</param>
        public EntityContextTypeAttribute(int accessType)
            : this(accessType, null)
        {
        }

        /// <summary>
        /// 特定编号
        /// </summary> 
        public string[] SpecialContextCodes
        {
            get { return fields; }
        }

        /// <summary>
        /// 实体数据库类型
        /// </summary> 
        public int ContextType
        {
            get { return accessType; }
        }
    }
}
